package org.vaadinpa.gui.util;

import org.vaadinpa.gui.VaadinPA;

import com.vaadin.ui.Window.Notification;

public class NotificationUtil {

	public static void notify(String caption, String msg) {
		notify(caption, msg, Notification.TYPE_HUMANIZED_MESSAGE);
	}

	public static void warn(String caption, String msg) {
		notify(caption, msg, Notification.TYPE_WARNING_MESSAGE);
	}

	public static void error(String caption, String msg) {
		notify(caption, msg, Notification.TYPE_ERROR_MESSAGE);
	}

	private static void notify(String caption, String msg, int type) {
		Notification n = new Notification(caption, "<br>" + msg, type);
		VaadinPA.getCurrent().getMainWindow().showNotification(n);
	}
}
